import {list} from '@/api/depart'

const state = {
    data: []
}

const mutations = {
    SET_DEPART_LIST: (state, list) => {
        state.data = list
    }
}

const actions = {
    // user login
    list({ commit }, where) {
        return new Promise((resolve, reject) => {
            list(where).then(response => {
                const { data } = response
                // console.log("store/modules/depart", data)
                commit('SET_DEPART_LIST', data)
                resolve(data)
            }).catch(error => {
                reject(error)
            })
        })
    },
}
export default {
    namespaced: true,
    state,
    mutations,
    actions
}